package de.oszimtcc.timetableservices;

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;
import de.oszimtcc.timetable.TimetableApplication;

/**
 * @author reuter
 * 
 */
public class ServiceTools
{

	public static boolean isServiceRunning(String serviceClassName)
	{
		final ActivityManager activityManager = (ActivityManager)TimetableApplication.getInstance().getActivity().getSystemService(Context.ACTIVITY_SERVICE);
		final List<RunningServiceInfo> services = activityManager.getRunningServices(Integer.MAX_VALUE);

		for(RunningServiceInfo runningServiceInfo : services)
		{
			if(runningServiceInfo.service.getClassName().equals(serviceClassName))
			{
				return true;
			}
		}
		return false;
	}
}
